package com.zhouxiaoge.atomic;

import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicStampedReference;

/**
 * @author 周小哥 gqzmy@163.com 2023/2/24 9:55
 */

public class AtomicTest {
    public static void main(String[] args) {
        AtomicLong atomicLong = new AtomicLong(0);
        boolean b = atomicLong.compareAndSet(1, 2);
        System.out.println(b);

        AtomicStampedReference<Integer> atomicStampedReference = new AtomicStampedReference<>(1, 1);
        boolean b1 = atomicStampedReference.compareAndSet(1, 2, 1, 2);
        System.out.println(b1);
    }
}
